/**
 * Created by oneminute on 8/30/14.
 */

exports = module.exports = {
    basePath: __dirname + '/../routes',
    filters: [
        {
            name: 'userFilter',
            module: '/userfilter.js'
        }
    ],
    paths: [
        {
            path: '/search.html',
            template: 'search',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/search.html.js'
        },
        {
            path: '/search',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/search.js',
            params: [
                {
                    name: "lat",
                    from: "query",
                    type: "float",
                    rule: {
                        range: {
                            from: -90,
                            to: 90
                        }
                    },
                    require: true
                },
                {
                    name: "lon",
                    from: "query",
                    type: "float",
                    rule: {
                        range: {
                            from: -90,
                            to: 90
                        }
                    },
                    require: true
                },
                {
                    name: "type",
                    from: "query",
                    type: "string",
                    rule: {
                        values: ['commodities', 'demands', 'gifts']
                    },
                    require: false,
                    default: 'commodities'
                },
                {
                    name: "p",
                    from: "query",
                    type: "int",
                    rule: {
                        range: {
                            from: 0,
                            to: 65535
                        }
                    },
                    require: false,
                    default: 0
                },
                {
                    name: "count",
                    from: "query",
                    type: "int",
                    rule: {
                        range: {
                            from: 1,
                            to: 34
                        }
                    },
                    require: false,
                    default: 10
                }
            ]
        },
        {
            path: '/register.html',
            template: 'register',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/register.html.js'
        },
        {
            path: '/register',
            params: [
                {
                    name: "code",
                    from: "body",
                    type: "string",
                    require: true
                },
                {
                    name: "loginPhone",
                    from: "body",
                    type: "string",
                    require: true
                },
                {
                    name: "password",
                    from: "body",
                    type: "string",
                    require: true
                }
            ],
            filters: ['userFilter'],
            methods: ["POST"],
            module: '/register.js'
        },
        {
            path: '/login.html',
            template: 'login',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/login.html.js'
        },
        {
            path: '/login',
            params: [
                {
                    name: "loginPhone",
                    from: "body",
                    type: "string",
                    require: true
                },
                {
                    name: "password",
                    from: "body",
                    type: "string",
                    require: true
                }
            ],
            filters: ['userFilter'],
            methods: ["POST"],
            module: '/login.js'
        },
        {
            path: '/thirdlogin',
            filters: ['userFilter'],
            methods: ['POST'],
            module: '/thirdlogin.js'
        },
        {
            path: '/owninfo',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/owninfo.js'
        },
        {
            path: '/owninfo.html',
            template: 'owninfo',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/owninfo.html.js'
        },
        {
            path: '/updateuserphoto',
            params: [
                {
                    name: "photo",
                    from: "files",
                    type: "file",
                    require: true
                }
            ],
            filters: ['userFilter'],
            methods: ["POST"],
            module: '/updateuserphoto.js'
        },
        {
            path: '/updateuserdetails',
            params: [
                {
                    name: "lat",
                    from: "body",
                    type: "float",
                    rule: {
                        range: {
                            from: -90,
                            to: 90
                        }
                    },
                    require: true
                },
                {
                    name: "lon",
                    from: "body",
                    type: "float",
                    rule: {
                        range: {
                            from: -90,
                            to: 90
                        }
                    },
                    require: true
                },
                {
                    name: "inbusiness",
                    from: "body",
                    type: "boolean",
                    require: true
                },
                {
                    name: "phone",
                    from: "body",
                    type: "string",
                    require: true
                },
                {
                    name: "address",
                    from: "body",
                    type: "string",
                    require: true
                },
                {
                    name: "description",
                    from: "body",
                    type: "string",
                    require: true
                }
            ],
            filters: ['userFilter'],
            methods: ["POST"],
            module: '/updateuserdetails.js'
        },
        {
            path: '/releasegoods',
            params: [
                {
                    name: "description",
                    from: "body",
                    type: "string",
                    require: true
                },
                {
                    name: "price",
                    from: "body",
                    type: "float",
                    require: true
                }
            ],
            filters: ['userFilter'],
            methods: ["POST"],
            module: '/releasegoods.js'
        },
        {
            path: '/updategoods',
            params: [
                {
                    name: 'gid',
                    from: 'query',
                    type: 'string',
                    require: true
                },
                {
                    name: 'description',
                    from: 'body',
                    type: 'string',
                    require: true
                },
                {
                    name: 'price',
                    from: 'body',
                    type: 'float',
                    require: true
                }
            ],
            filters: ['userFilter'],
            methods: ["POST"],
            module: '/updategoods.js'
        },
        {
            path: '/owngoodsdetails',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/owngoodsdetails.js'
        },
        {
            path: '/owngoods',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/owngoods.js'
        },
        {
            path: '/owngoodsselling',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/owngoods.js'
        },
        {
            path: '/topgoods',
            params: [
                {
                    name: 'gid',
                    from: 'query',
                    type: 'string',
                    require: true
                }
            ],
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/topgoods.js'
        },
        {
            path: '/delgoods',
            params: [
                {
                    name: 'gid',
                    from: 'query',
                    type: 'string',
                    require: true
                }
            ],
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/delgoods.js'
        },
        {
            path: '/ownneeds',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/ownneeds.js'
        },
        {
            path: '/updateneed',
            filters: ['userFilter'],
            methods: ["POST"],
            module: '/updateneed.js'
        },
        {
            path: '/delneed',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/delneed.js'
        },
        {
            path: '/topneed',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/topneed.js'
        },
        {
            path: '/releaseneed',
            filters: ['userFilter'],
            methods: ["POST"],
            module: '/releaseneed.js'
        },
        {
            path: '/shop',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/shop.js'
        },
        {
            path: '/shopgoods',
            params: [
                {
                    name: "suid",
                    from: "query",
                    type: "string",
                    require: false
                },
                {
                    name: "p",
                    from: "query",
                    type: "int",
                    require: true
                }
            ],
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/shopgoods.js'
        },
        {
            path: '/shopneeds',
            params: [
                {
                    name: "suid",
                    from: "query",
                    type: "string",
                    require: false
                },
                {
                    name: "p",
                    from: "query",
                    type: "int",
                    require: true
                }
            ],
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/shopneeds.js'
        },
        {
            path: '/goods',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/goods.js'
        },
        {
            path: '/need',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/need.js'
        },
        {
            path: '/uploadissue.html',
            template: 'uploadissue',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/uploadissue.html.js'
        },
        {
            path: '/uploadissue',
            filters: ['userFilter'],
            methods: ["POST"],
            module: '/uploadissue.js'
        },
        {
            path: '/version',
            filters: ['userFilter'],
            methods: ["GET"],
            module: '/version.js'
        },
        {
            path: '/uploadissue',
            filters: ['userFilter'],
            methods: ['GET'],
            module: '/uploadissue.js'
        },
        {
            path: '/findpassword',
            params: [
                {
                    name: "email",
                    from: "body",
                    type: "string",
                    require: false
                },
                {
                    name: "name",
                    from: "body",
                    type: "string",
                    require: false
                },
                {
                    name: "loginPhone",
                    from: "body",
                    type: "string",
                    require: false
                }
            ],
            filters: ['userFilter'],
            methods: ['POST'],
            module: '/findpassword.js'
        },
        {
            path: '/modifypassword',
            params: [
                {
                    name: "oldpassword",
                    from: "body",
                    type: "string",
                    require: true
                },
                {
                    name: "newpassword",
                    from: "body",
                    type: "string",
                    require: true
                }
            ],
            filters: ['userFilter'],
            methods: ['POST'],
            module: '/modifypassword.js'
        },
        {
            path: '/modifyname',
            params: [
                {
                    name: "name",
                    from: "body",
                    type: "string",
                    require: true
                }
            ],
            filters: ['userFilter'],
            methods: ['POST'],
            module: '/modifyname.js'
        },
        {
            path: '/exit',
            filters: ['userFilter'],
            methods: ['GET'],
            module: '/exit.js'
        },
        {
            path: '/uploadapp.html',
            template: 'uploadapp',
            params: [
                {
                    name: "device",
                    from: "query",
                    type: "string",
                    require: false,
                    default: "android"
                }
            ],
            filters: ['userFilter'],
            methods: ['GET'],
            module: '/uploadapp.html.js'
        },
        {
            path: '/uploadapp',
            params: [
                {
                    name: 'device',
                    from: 'body',
                    type: 'string',
                    require: false,
                    default: "android"
                },
                {
                    name: 'version',
                    from: 'body',
                    type: 'string',
                    require: true
                },
                {
                    name: 'app',
                    from: 'files',
                    type: 'file',
                    require: true
                },
                {
                    name: 'comment',
                    from: 'body',
                    type: "string",
                    require: false
                }
            ],
            filters: ['userFilter'],
            methods: ['POST'],
            module: '/uploadapp.js'
        },
        {
            path: "/requestcode",
            params: [
                {
                    name: 'phone',
                    from: 'query',
                    type: 'string',
                    require: true
                }
            ],
            filters: ["userFilter"],
            methods: ['GET'],
            module: '/requestcode.js'
        },
        {
            path: "/latest",
            params: [
                {
                    name: 'device',
                    from: 'query',
                    type: 'string',
                    require: true
                }
            ],
            filters: ["userFilter"],
            methods: ['GET'],
            module: '/latest.js'
        },
        {
            path: "/manage",
            template: 'manage',
            methods: ['GET'],
            module: '/manage.js'
        },
        {
            path: "/useragreement",
            template: 'useragreement',
            methods: ['GET'],
            module: '/useragreement.js'
        }
    ]
};